Repository navigation
perf: don't revisit sleeping contacts when bodies wake up or fall asleep - #1078
Open
kylegrahammatzen wants to merge 2 commits into
Open
kylegrahammatzen wants to merge 2 commits into
kylegrahammatzen wants to merge 2 commits into
Conversation
Waking up or putting to sleep an island made maintain_solver_contact_graph go through every contact pair in the world, sleeping ones included. The rebuild now visits only the pairs whose hint makes them selectable plus the ones the buckets already hold, in increasing order so the graph comes out the same. A new solver_graph_refs_trusted flag falls back to the full walk whenever edges moved without the buckets being fixed up, and debug builds check that no skipped pair still holds a graph position.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every time a body wakes up or falls asleep, Rapier rebuilds its list of contacts for the solver by going through every contact in the world, including all the ones between sleeping bodies that can't change, so waking a single box in a big scene that's mostly at rest takes time in proportion to the whole scene.
Now it only looks at contacts that involve an awake body and gets the same list as before where after a collider is removed or a snapshot is loaded, it still checks everything to be safe.
The simulation itself doesn't change, and the existing determinism tests pass with the same hashes.